home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3930 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  51 lines

  1. Path: thor.tu.hac.com!collins
  2. From: collins@thor.tu.hac.com (Ron Collins)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Unbuffered character input...
  5. Date: 1 Feb 1996 00:59:45 GMT
  6. Organization: Advanced Depot Systems
  7. Message-ID: <4ep3a1$bee@hacgate2.hac.com>
  8. References: <Pine.SGI.3.91.960129190205.27936A-100000@tahiti.cs.unm.edu> <4elf0t$5vd@ixnews2.ix.netcom.com>
  9. NNTP-Posting-Host: thor.tu.hac.com
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Kevin Landry (kevgar@ix.netcom.com) wrote:
  13. : Caleb Haley <chaley@tahiti.cs.unm.edu> wrote:
  14.  
  15. : >Greetings!
  16.  
  17. : >Just curious--is there a way to do unbuffered character input in c?
  18. : >i.e.  getting just one character without waiting for a carriage return 
  19. : >(enter)...
  20.  
  21. : I believe there are two commands in C that do this. getch() is
  22. : unbuffered input without echo and getche() has the echo. Hope this
  23. : helps.
  24.  
  25. : -kevgar@ix.netcom.com
  26. :      "Cry havoc, and let slip
  27. :              the dogs of war!!"
  28.  
  29. No, these are not standard C functions.  (What is a "command"?)  These
  30. functions are only available on DOS compilers as non-standard extensions.
  31.  
  32. There is no portable way to get unbuffered input, since C can't possibly
  33. know all about the dozens or hundreds of different terminal types available
  34. on all the machines made around the world.
  35.  
  36. For best results (i.e., least evil alternative), check out the "curses"
  37. library available for your machine.  Most common flavors can be had for
  38. free from any SimTel mirror.
  39.  
  40.  
  41.                         -- Collins --
  42.                         
  43. -----
  44. The views expressed here are mine alone.
  45.  
  46. Ron Collins/Hughes Aircraft Company/M20,P20/Tucson Az 85706
  47. rcollins@thor.tu.hac.com    collins@seagull.rtd.com
  48. ยก----
  49.  
  50.  
  51.